V6R1
CWBCOTRC
The program,
CwbCoTrc.exe, has not been thoroughly tested under all conditions.
THE IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
Document
Description:
System
i Access for Windows uses traces to obtain
information that can help us identify the problem, when something is not
working as expected. There are many different trace tools in the product that
provide trace information, such as System i Access
Detail Trace. System i Access for Windows
Communication Trace (cwbcotrc) in comparison to Detail Trace provides more
useful communication information includes all components and all data sent and
received but does not have a graphical interface.
This document describes how to use the
new V6R1 cwbcotrc. It also describes what the new enhancements are, what was
changed from the previous release, what is still the same
and what functions were removed from the tool.
Cwbcotrc was enhanced based on four V6R1
that was used to implement the new functionalities.
V6R1 cwbcotrc requirements:
Per-process trace files: The cwbcotrc trace file will be created on a
per process basis.
Trace file wrapping: The trace file will have an optional wrapping
size defined by the user.
Component filtering: Cwbcotrc will allow filtering component.
Dynamic start/stop of trace at per-process
level: Cwbcotrc will be able
to display a list of all the System i Access
processes that are running on that computer. And the user can choose what
processes he wants to trace.
This tool allows tracing the processes
and components of the user choosing. With these new functionalities the
information provided by the trace tool is more useful and more specific to the
problem that we are trying to solve.
This means the trace file will only contain the information the user
specifies to trace. And we can keep it simple and fast to locate any
abnormality on the trace.
This
client communications trace can be started and stopped by running cwbcotrc.exe
from a command prompt. To see the command format, run cwbcotrc without any
options.
Syntax
and help format:
Format:
CWBCOTRC ( ON | OFF |
[ /
[ /PROCESS:[PID],... |
[ /WRAP:1-4095 | OFF ]
[ /COMPONENTS:"Component
Name", ... |
[ /SSL:0-1 ]
[ /
[ /ALLUSERS ]
[ /.DEFAULT:0-1 ]
[ /HELPDETAILS ]
ON |
OFF = turn tracing on or off
LIST = List trace status
of all the System i Access processes.
/
/PROCESS: = Apply settings to
specific processes by pid or
name
/WRAP: = Maximum trace file
size in MB, default is 100 MB
/COMPONENTS: = Enable trace for specific components, default is
/SSL: = Include SSL data in
trace, default is 0
/ALLUSERS = Apply settings to
all users
/.DEFAULT: = Apply settings to
.Default user profile
/HELPDETAILS = Extensive help information (in html)
Components
List: Administration, Incoming Remote
Command, File Systems
Configuration, Communication, Comm-
Comm-Base, Data Access, Data Queues, Data
Transforms
Install, License Management, Migration, NLS, Network Print
Net2 Print, Network Provider, ODBC, ODBC-Driver Manager
ODBC-Error, Emulator, Remote Command, Service, Security
Data Transfer, User Interface, Update, Management Central
Reserved1, Reserved2, Reserved3, Reserved4, Reserved5
Reserved6, Reserved7, Reserved8
Status of global cwbCoTrace:
> Trace: On
> SSL Data: No
> Components:
> Wrap: 100 MB
> Path: C:\Documents and Settings\All
Users\Documents\
Status of current-user-only cwbCoTrace:
Trace: Off
SSL
Data: No
Components:
Wrap: 100 MB
Path: C:\Documents and
Settings\administrator\My Documents\
User: Administrator
'>' shows which
settings are currently active.
LIST
The LIST
argument was added in V6R1. This option lists all the current System i Access processes running on the computer and shows status
for each one. The status data for each process is: the name of the application,
the process ID, if trace is on/off, if SSL is on/off, wrap size, components
that are filtered, and the trace file name.
To view the process list, execute the command “cwbcotrc
list”. And you will see a similar process list that the one on the picture
below.
Process List:
Name = cwbtf.exe PID = 4488 Trace = On
SSL = Off WrapSize=100MB
Filter =
File = C:\DOCUME~1\ALLUSE~1\DOCUME~1\
name=rundll32.exe pid=6036 trace= On
ssl=Off
wrapSize=100MB
Filter =
File= C:\DOCUME~1\ALLUSE~1\DOCUME~1\
/
We modified the /
/PROCESS:<PID>,<PID> | <
The /PROCESS
switch was added on V6R1. With this option we can modify process specific trace
values including: On/Off, SSL On/Off, wrap size and component filter list.
Usage
Examples:
Turn ON | OFF the trace for the process ID(s)
specified or
CWBCOTRC (ON | OFF) /PROCESS:[PID],... |
Turn
ON | OFF the logging of SSL data for the process ID(s) specified or
CWBCOTRC (ON | OFF )
/PROCESS:[PID],... |
Change
the wrap size for the process ID(s) specified or
CWBCOTRC ( ON | OFF ) /PROCESS:[PID],... |
Change
the components list to be trace for the process ID(s) specified or
CWBCOTRC
(ON | OFF ) /PROCESS:[PID],... |
/WRAP: <1–4095> | <DFLT>
The new /WRAP switch was added in V6R1. This option will allow the user to start wrapping a trace file when a
valid size value is specified. By default wrapping is 100MB.
And any invalid value will change wrapping to the default value (100MB). The wrapping size will be the maximum trace
file size, and the new data will supersede the old data. The /WRAP option can
apply for all processes (maximum size for any trace file) or for a specific
process (maximum size for just that file) when the /PROCESS switch is specified
with a valid process ID(s).
The wrap count and wrap
size could be located on the header at the beginning of the trace file.
t=11b0
13:01:35.531 [00] NLS: ** WRAP wrapCount=0
cwbtrace-
t=11b0
13:01:35.531 [00] NLS: ** OPTIONS wrapSize=100 ssl=1
t=11b0
13:01:35.531 [00] NLS: **
YYYY-MM-DD 2007-05-08
The wrap point could be
located on the trace file by the <EOF> mark. The row before this mark is
the latest written data. And the row after <EOF> is the oldest data in
the trace file id the file have already wrapped.
t=11b0 13:01:35.531
[00] NLS: NL GetANSICodePage
t=11b0
13:01:35.750 [00] NLS: NL GetCodePage cp=437
t=11b0
13:04:24.015 [00] Configuration: IsComponentInstalledEntry
t=11b0
13:04:24.015 [00] Configuration: IsComponentInstalledExit
<EOF>
Usage Examples:
To set the wrap size to 10 MB for the
process 4488:
CWBCOTRC ON /PROCESS:4488
/WRAP:10
To set the wrap size for all the future
processes execute the command:
CWBCOTRC ON /ALLUSERS /WRAP:10
/COMPONENTS:<”Component name”>,
< ”Component name” > | <
We remove the /ALLCOMP switch and now we
use the /COMPONENTS instead on V6R1.
This option allows the user to choose
what components to trace. The default is
On the help we display an available
Components List to be used with the /COMPONENTS switch.
The component name should be between quotation
marks when it has a blank space between two words. If the component name is a
single word then quotes are not needed.
Components List: Administration, Incoming Remote
Command, File Systems,
Configuration, Communication, Comm-
Comm-Base, Data Access, Data Queues, Data Transforms,
Install, License Management, Migration, NLS, Network Print,
Net2 Print, Network Provider, ODBC, ODBC-Driver Manager,
ODBC-Error, Emulator, Remote Command, Service, Security,
Data Transfer, User Interface, Update, Management Central,
Reserved1, Reserved2, Reserved3, Reserved4, Reserved5,
Reserved6, Reserved7, Reserved8.
Usage Examples:
To set the components to filter to NLS
and OBDC for the process 4488:
CWBCOTRC ON /PROCESS:4488
/COMPONENTS:NLS,ODBC
To set the components to filter to NLS
and ODBC for all the future processes :
CWBCOTRC ON /COMPONENTS:NLS,ODBC
If the components are composed for more that
one word, quotes should be used.
CWBCOTRC ON /COMPONENTS:”Data
Transfer”, “Remote Command”
Set the components filter to
CWBCOTRC ON /PROCESS:4488,6036
/COMPONENTS:
/SSL:[1 | 0] where 1 = ON and 0 = OFF
Turn on/off ssl
/
The
Usage Examples:
Deletes cwbtrace-32-cwbping.exe-1234.log trace file
CWBCOTRC ON /
Deletes
all the trace files on the trace folder
CWBCOTRC
Deletes all the trace files that match
with the wildcard
Deletes all files logged while running
cwbtf.exe
CWBCOTRC /
Currently settings
This
'>' character shows which
settings are currently active. This character ‘>’ show us if the all users
settings or current users settings are active. If none are active none will be
selected.
Status of global cwbCoTrace:
> Trace: On
> SSL Data: Yes
> Components:
> Wrap: 100 MB
> Path: C:\Documents and Settings\All
Users\Documents\
Status of current-user-only cwbCoTrace:
Trace: Off
SSL
Data: Yes
Components:
Wrap: 100 MB
Path: C:\Documents and Settings\serch\My Documents\
User: serch
'>' shows which
settings are currrently active.
Trace file
Each System i Access
process will have its own trace file. And the name of the trace file will be “cwbtrace-32-?????.???-XXXX.log”
where “?????.???” is the Name of the application and
“XXXX” is the process ID. On a 64-bit machine the trace file name should be
cwbtrace-64-?????.???-XXXX.log
Examples:
cwbtrace-32-cwbunnav.exe-4828.log
cwbtrace-32-cwbtf.exe-6084.log
cwbtrace-32-cwblmsrv.exe-4976.log
A process qualifies as a System i Access
process if it directly or indirectly loads the cwbcore.dll. In addition to the
expected cwb*.exe and pcsws.exe process instances are
several perhaps unexpected applications that also load cwbcore.dll. Some of
those applications are Microsoft's IIS, excel.exe, and explorer.exe.
An
Administrator user account is expected to be using this tool if they want full
control over all the System i Access processes, a
non-administrator should only see their own (owned) processes traced and
listed.
The
tool also show which is the current user logged on the computer.
Status of current-user-only cwbCoTrace:
Trace: Off
SSL
Data: Yes
Components:
Wrap: 100 MB
Path: C:\Documents and
Settings\serch\My Documents\
User: serch
And we can also find that information at the
beginning of the trace file
NLS:
** WRAP wrapCount=0 cwbtrace-4832 user=serch vrm=5.5.0
NLS: ** YYYY-MM-DD 2007-05-08
A better text editor than notepad should be used to
display correctly the new trace files. If you open a trace file with the new
V6R1 format with notepad the data will not be formatted correctly. WordPad is a
good editor to open the trace files.
There is a new
The new
\\rchfs.rchland.ibm.com\groups\w32tools\ctt\
SPIs
We
exported the ansi and wide
cwbCoTraceFileName()
cwbCoTraceFileNameW()
We
created and export a new
cwbCoTraceFileClear()
We created and export a new
UINT CWB_ENTRY
cwbCO_setCOTraceProcess(
bool turnOnOff,
int * wrapSize,
bool * ssl,
bool * comps,
unsigned * PID);
Parameters:
turnOnOff: ALWAYS REQUIRED - Set True or false to
turn ON/OFF the trace for that PID.
wrapSize: Set the wrap size
for that PID, if NULL or invalid value no changes are made. wrapSize must be 1
- 4095 MB.
ssl: Set true or
false to turn ON/OFF SSL for that PID, if NULL no changes are made.
comps: Set the components
to be filtered. Pass in a bool * comps[CWB_COMP_NUM_
PID: If we pass in a
PID the process info of that PID will be set, if NULL the current PID will be
used.
Return values:
If successful, returns CWB_OK; otherwise if the PID was invalid, returns CWB_INVALID_HANDLE.
We created and export a new
UINT CWB cwbCO_GetCOTraceProcess(
bool * turnOnOff,
int * wrapSize,
bool * ssl,
bool * comps,
unsigned * PID);
Parameters:
turnOnOff: Returns True or false if trace is
active or not for that PID
wrapSize: Returns the wrap size for that PID
ssl: Returns true
or false, if SSL is active or not for that PID.
comps: We get back a bool
* with all the components that are filtered. Pass in a bool *
comps[CWB_COMP_NUM_
PID: If
we pass in a PID value, the process info of that PID will be returned. If NULL
then current PID settings will be returned.
Return values:
If successful, returns CWB_OK; otherwise if the PID was invalid, returns CWB_INVALID_HANDLE.
What was removed?
The /LIMIT switch was removed in V6R1.
This option will
not be accepted any more, and was removed from the help. This is because it is
no longer used. If the data received for each line is to
big, this data will be truncated to the largest permitted size.
We remove the /ALLCOMP switch and now we use the /COMPONENTS instead. See the
section “what’s new” for more details.
What was changed?
Cwbsvget was affected by this new design in the way that this
tool searches for the trace files, with the new functionalities implemented in
this design there will now be one trace file per each System i Access process. So, the cwbsvget
tool was enhanced to collect all the .log trace files instead of collecting
only one file.
What is still the same?
Switch ON/OFF can be used the same way as V5R4 and previous releases. It can
be set for either the current user OR for the entire PC (i.e. all processes
that are run thereafter under ANY uid OR under "LocalSystem", which is what services typically run
under).
/SSL can be used the same way as V5R4 and
previous releases.
/ALLUSERS can be used the same way as
V5R4 and previous releases. This switch allows us to trace all the processes
that are running under any users ID. However, the trace files are still
separate – one per process – rather than combined into the same file as was the
case in V5R4.
/.DEFAULT can be used the same way as
V5R4 and previous releases. Applies settings to .default user
profile. The .default windows registry user profiles is used for
services like IIS, OBDC and Incoming Remote Command (
cwbrxd.exe )
Specifying
cwbcotrc without options or with (/? /h /help), will show the help and also
will display the possible components that can be filtered.
Common scenario!
Turn on the trace with all components
and all users
Open a command prompt window
Run the command “
Run an System i
application
Execute "C:\Program Files\
Select the
system and file name to download from the server
Select the output option
Click on Transfer Data from System i
View the generated trace file
Run the command “cwbcotrc list” to see
the trace file name.
Go to the trace path and open the trace
file that match with the process ID
(FAQ) Frequently Asked Questions:
Can a trace file be deleted while the process is still running?,
Yes, it can be deleted manually, and the
new trace entry will reopen the trace file.
Is there a tool that I can use to merge multiple traces together
into one?,
No.
Is cwbcotrc tracing multi-thread capable, so multiple threads can
log without mixing up the trace data?,
Yes, cwbcotrc is multi-thread capable.
Are cwbcotrc configured values backed up by cwbback?,
Only the current users setting are
backed up with cwbback and not the all users settings.
Can I start trace for an already-running process?,
Yes, for a process that is already
running you should first find the process ID for that process, running the
command:
cwbcotrc LIST
After you identify the PID for the
process you want start tracing, then run the command:
cwbcotrc ON /PROCESS:[process ID]
Can I end trace for a running process, then start it again later,
and it will just append to the existing trace file?
Yes, when a when a process is stopped
and then started again it will just append to the existing file.